home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Presentations / Presentations ’93 / Macintosh as Internet Server ƒ / inetd / in.rshd / in.rcp / rcp.h < prev    next >
Text File  |  1993-04-08  |  2KB  |  89 lines

  1. //---------------------------------------------------------------------
  2. //
  3. //    Copyright © 1992 David Peterson.
  4. //    All rights reserved.
  5. //
  6. //    Permission to use, copy, modify, and distribute this software for
  7. //    any purpose and without fee is hereby granted, provided that the
  8. //    above copyright notice appear in all copies and that both that
  9. //    copyright notice and this permission notice appear in supporting
  10. //    documentation.
  11. //
  12. //---------------------------------------------------------------------
  13.  
  14. #ifndef __DAEMONAPP__
  15. #include <DaemonApp.h>
  16. #endif
  17. #ifndef __MACTCPCOMMONTYPES__
  18. #include <MacTCPCommonTypes.h>
  19. #endif
  20.  
  21. class Rcp : public DaemonApp {
  22. typedef DaemonApp Inherited;
  23. typedef void (*rcpProc)(Rcp* it);
  24. public:
  25.     char            fCommandString[256];
  26.     
  27.     StreamPtr        fStreamPtr;
  28.     short            fRefNum;
  29.     
  30.     Ptr                fBuffer;
  31.     int                fBufLen;
  32.     
  33.     int                fFileSize;
  34.     int                fAmtLeft;
  35.     
  36.     Boolean            fWorkingOnAFile;
  37.     
  38.     short            fFileIORefNum;
  39.     Str255            fFileName;
  40.     
  41.     Boolean            fTargetShouldBeDir;
  42.     Boolean            fTargetIsDir;
  43.     Boolean            fIAmRecursive;
  44.     Boolean            fToFlag;
  45.     Boolean            fFromFlag;
  46.     
  47.     short            fVRefNum;
  48.     long            fDirID;
  49.     
  50.     rcpProc            fMore;
  51.     rcpProc            fFile;
  52.  
  53.                     Rcp();
  54.     virtual            ~Rcp();
  55.                     
  56.     virtual void     InstallAEHandlers();
  57.     virtual void    Initialize();
  58.     virtual void    DoNull();
  59.  
  60.     void            GetMore();
  61.     void            NewFile();
  62.     
  63.     void            ReadMore();
  64.     void            OpenNext();
  65.  
  66.     void            VerifyAndSetDir(char* test);
  67.     
  68.     void            ParseCommandString();
  69.     void            TakeControlOfStream();
  70.     
  71.     Boolean            CreateFile(Str255 name, char type);
  72.     void            CloseFile();
  73.     void            WriteToFile(char* buf, short len);
  74.     void            UpDir();
  75.     
  76.     void            SendOK();
  77.     void            SendError(char* msg);
  78. };
  79.  
  80. extern "C" {
  81.     pascal OSErr     AEStreamHandler(AppleEvent *messagein, AppleEvent *reply, long refIn);
  82.  
  83.     pascal void        Notify(    StreamPtr            tcpStream,
  84.                             unsigned short        eventCode,
  85.                             Ptr                    userDataPtr,
  86.                             unsigned short        termReason,
  87.                             struct ICMPReport*    icmpMessage    );
  88. };
  89.